package com.bootssm.controller;

import com.bootssm.dao.TeamBallMapper;
import com.bootssm.enity.PageView;
import com.bootssm.enity.TeamBallResultV0;
import com.bootssm.enity.TeamballResultQueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/schedule")
public class ScheduleController {
    @Autowired
    TeamBallMapper teamBallMapper;

    @PostMapping("/findAll")
    public PageView<TeamBallResultV0> findAll(@RequestBody TeamballResultQueryVO teamballResultQueryVO) {
        Integer page=teamballResultQueryVO.getPage();
        Integer start = (page-1)*teamballResultQueryVO.getSize();
        teamballResultQueryVO.setStart(start);
        List<TeamBallResultV0> teamBallResultV0List = teamBallMapper.findResultAll(teamballResultQueryVO);

        Integer count = teamBallMapper.getScheduleCount(teamballResultQueryVO);
        PageView<TeamBallResultV0> pageView=new PageView<>();
        pageView.setDataList(teamBallResultV0List);
        pageView.setCount(count);
        return pageView;
    }
}
